/*
 * Movement.java
 * 
 * Created on 19-jun-2007, 20:51:29
 * 
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.i2a.peacsy.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Tortuga
 */
@Entity
@Table(name = "TA_MOVE_MOVEMENTS")
@NamedQueries({@NamedQuery(name = "Movement.findByMoveCoCode", query = "SELECT m FROM Movement m WHERE m.moveCoCode = :moveCoCode"), @NamedQuery(name = "Movement.findByMoveLiDescription", query = "SELECT m FROM Movement m WHERE m.moveLiDescription = :moveLiDescription"), @NamedQuery(name = "Movement.findByMoveDaAccountDate", query = "SELECT m FROM Movement m WHERE m.moveDaAccountDate = :moveDaAccountDate"), @NamedQuery(name = "Movement.findByAudiInSituation", query = "SELECT m FROM Movement m WHERE m.audiInSituation = :audiInSituation"), @NamedQuery(name = "Movement.findByAudiDaCreationDate", query = "SELECT m FROM Movement m WHERE m.audiDaCreationDate = :audiDaCreationDate"), @NamedQuery(name = "Movement.findByAudiLiCreationUsr", query = "SELECT m FROM Movement m WHERE m.audiLiCreationUsr = :audiLiCreationUsr"), @NamedQuery(name = "Movement.findByAudiDaUpdateDate", query = "SELECT m FROM Movement m WHERE m.audiDaUpdateDate = :audiDaUpdateDate"), @NamedQuery(name = "Movement.findByAudiLiUpdateUsr", query = "SELECT m FROM Movement m WHERE m.audiLiUpdateUsr = :audiLiUpdateUsr")})
public class Movement implements Serializable {

  @Id
  @Column(name = "MOVE_CO_CODE", nullable = false)
  private Integer moveCoCode;

  @Column(name = "MOVE_LI_DESCRIPTION")
  private String moveLiDescription;

  @Column(name = "MOVE_DA_ACCOUNT_DATE")
  @Temporal(TemporalType.DATE)
  private Date moveDaAccountDate;

  @Column(name = "AUDI_IN_SITUATION")
  private Short audiInSituation;

  @Column(name = "AUDI_DA_CREATION_DATE")
  @Temporal(TemporalType.TIMESTAMP)
  private Date audiDaCreationDate;

  @Column(name = "AUDI_LI_CREATION_USR")
  private String audiLiCreationUsr;

  @Column(name = "AUDI_DA_UPDATE_DATE")
  @Temporal(TemporalType.TIMESTAMP)
  private Date audiDaUpdateDate;

  @Column(name = "AUDI_LI_UPDATE_USR")
  private String audiLiUpdateUsr;

  @OneToMany(cascade = CascadeType.ALL, mappedBy = "moveCoCode")
  private Collection<Entry> entryCollection;

  @JoinColumn(name = "WALL_CO_CODE", referencedColumnName = "ACCO_CO_CODE")
  @ManyToOne
  private WalletAccount wallCoCode;
    protected static org.apache.commons.logging.Log
        log = org.apache.commons.logging.LogFactory.getLog(Movement.class);

    public Movement() {
    }

  public Movement(Integer moveCoCode) {
    this.moveCoCode = moveCoCode;
  }

  public Integer getMoveCoCode() {
    return moveCoCode;
  }

  public void setMoveCoCode(Integer moveCoCode) {
    this.moveCoCode = moveCoCode;
  }

  public String getMoveLiDescription() {
    return moveLiDescription;
  }

  public void setMoveLiDescription(String moveLiDescription) {
    this.moveLiDescription = moveLiDescription;
  }

  public Date getMoveDaAccountDate() {
    return moveDaAccountDate;
  }

  public void setMoveDaAccountDate(Date moveDaAccountDate) {
    this.moveDaAccountDate = moveDaAccountDate;
  }

  public Short getAudiInSituation() {
    return audiInSituation;
  }

  public void setAudiInSituation(Short audiInSituation) {
    this.audiInSituation = audiInSituation;
  }

  public Date getAudiDaCreationDate() {
    return audiDaCreationDate;
  }

  public void setAudiDaCreationDate(Date audiDaCreationDate) {
    this.audiDaCreationDate = audiDaCreationDate;
  }

  public String getAudiLiCreationUsr() {
    return audiLiCreationUsr;
  }

  public void setAudiLiCreationUsr(String audiLiCreationUsr) {
    this.audiLiCreationUsr = audiLiCreationUsr;
  }

  public Date getAudiDaUpdateDate() {
    return audiDaUpdateDate;
  }

  public void setAudiDaUpdateDate(Date audiDaUpdateDate) {
    this.audiDaUpdateDate = audiDaUpdateDate;
  }

  public String getAudiLiUpdateUsr() {
    return audiLiUpdateUsr;
  }

  public void setAudiLiUpdateUsr(String audiLiUpdateUsr) {
    this.audiLiUpdateUsr = audiLiUpdateUsr;
  }

  public Collection<Entry> getEntryCollection() {
    return entryCollection;
  }

  public void setEntryCollection(Collection<Entry> entryCollection) {
    this.entryCollection = entryCollection;
  }

  public WalletAccount getWallCoCode() {
    return wallCoCode;
  }

  public void setWallCoCode(WalletAccount wallCoCode) {
    this.wallCoCode = wallCoCode;
  }

  @Override
  public int hashCode() {
    int hash = 0;
    hash += (moveCoCode != null ? moveCoCode.hashCode() : 0);
    return hash;
  }

  @Override
  public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof Movement)) {
      return false;
    }
    Movement other = (Movement) object;
    if (this.moveCoCode != other.moveCoCode && (this.moveCoCode == null || !this.moveCoCode.equals(other.moveCoCode))) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "org.i2a.peacsy.entity.Movement[moveCoCode=" + moveCoCode + "]";
  }

}
